<?php
/**
 * Created by PhpStorm.
 * User: 王松
 * Time: 2017/6/15 16:55
 */

namespace App\Project\Filters;

/**
 * 诊断项目字段过滤
 * Class DiagnoseFilter
 * @package App\Project\Filters
 */
class DiagnoseFilter extends FilterAbstract
{
    protected function forExtend()
    {
        $map = [];

        $diagnose = $this->request->input('diagnose');

        if (is_array($diagnose)) {
            $length = count($diagnose);

            for ($i = 0; $i < $length; $i++) {
                $map['diagnose'][] = 0;
            }
        }

        $map['cn_diagnose.type'] = array_keys(app('field')->get('diagnose.cn_diagnose.type'));

        return $map;
    }

    protected function getRootFieldsHasNoSon()
    {
        return ['id', 'record_id','diagnose','cn_diagnose','remark'];
    }

    protected function getRootFieldsHasSon()
    {
        return ['cn_diagnose'];
    }

    protected function getSonFieldsForEachRoot()
    {
        return ['wind', 'cold', 'heat', 'wet', 'dryness', 'hot', 'silt'];
    }
}